﻿namespace WMS6.SQLServerDAL
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.Common;
    using System.Data.SqlClient;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.DBUtility;
    using WMS6.IDAL;
    using WMS6.QueryEntity;

    public class TariffDA : ITariffDA
    {
        private string CREATED_BY = "@CREATED_BY";
        private string DESCR = "@DESCR";
        private string IS_ACTIVE = "@IS_ACTIVE";
        private string SQL_CHECK_TARIFF_ID_UNIQUE = " SELECT COUNT(1) FROM @_@TARIFF WHERE TARIFF_ID = @TARIFF_ID ";
        private string SQL_DELETE_TARIFF = " DELETE FROM @_@TARIFF WHERE TARIFF_ID = @TARIFF_ID ";
        private string SQL_INSERT_TARIFF = " INSERT INTO @_@TARIFF ( WH_ID, TARIFF_ID, DESCR, TARIFF_TYPE, TYPE_CODE, UDF1, UDF2, UDF3, UDF4, UDF5, UDF6, UDF7, UDF8, UDF9, UDF10, IS_ACTIVE, CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE) VALUES ( @WH_ID, @TARIFF_ID, @DESCR, @TARIFF_TYPE, @TYPE_CODE, @UDF1, @UDF2, @UDF3, @UDF4, @UDF5, @UDF6, @UDF7, @UDF8, @UDF9, @UDF10, @IS_ACTIVE, @CREATED_BY, GETDATE(), @UPDATED_BY, GETDATE() )  ";
        private string SQL_SELECT_ALL_TARIFF = " SELECT  ROWID, WH_ID, TARIFF_ID, DESCR, TARIFF_TYPE, TYPE_CODE, UDF1, UDF2, UDF3, UDF4, UDF5, UDF6, UDF7, UDF8, UDF9, UDF10, TS, IS_ACTIVE, CREATED_BY, CREATED_DATE, UPDATED_BY, UPDATED_DATE  FROM  @_@TARIFF ";
        private string SQL_SELECT_ALL_TARIFF_LANGUAGE = "SELECT   TA.ROWID, TA.WH_ID, TA.TARIFF_ID, TA.DESCR, T.[TEXT] AS TARIFF_TYPE , TA.TYPE_CODE, TA.UDF1, TA.UDF2, TA.UDF3,TA.UDF4, TA.UDF5, TA.UDF6, TA.UDF7, TA.UDF8, TA.UDF9, TA.UDF10, TA.TS, TA.IS_ACTIVE, TA.CREATED_BY, TA.CREATED_DATE, TA.UPDATED_BY, TA.UPDATED_DATE  FROM @_@TARIFF TA LEFT JOIN @_@SYS_CODE_DETAIL SCD ON SCD.SYS_CODE = TA.TARIFF_TYPE AND SCD.SYS_CODE_TYPE = 'TariffType' LEFT JOIN SYSADM.TRANSLATION T ON 'TariffType.'+TA.TARIFF_TYPE = T.ITEM_ID  AND  T.ITEM_TYPE = 'SYS_CODE_DETAIL' AND T.LANG+'-'+T.COUNTRY =@LANGUAGE  ";
        private string SQL_UPDATE_TARIFF = " UPDATE @_@TARIFF SET WH_ID = @WH_ID, DESCR = @DESCR, TARIFF_TYPE = @TARIFF_TYPE, TYPE_CODE = @TYPE_CODE, UDF1 = @UDF1, UDF2 = @UDF2, UDF3 = @UDF3, UDF4 = @UDF4, UDF5 = @UDF5, UDF6 = @UDF6, UDF7 = @UDF7, UDF8 = @UDF8, UDF9 = @UDF9, UDF10 = @UDF10, IS_ACTIVE = @IS_ACTIVE, UPDATED_BY = @UPDATED_BY, UPDATED_DATE = GETDATE() WHERE TARIFF_ID = @TARIFF_ID  ";
        private string TARIFF_ID = "@TARIFF_ID";
        private string TARIFF_TYPE = "@TARIFF_TYPE";
        private string TS = "@TS";
        private string TYPE_CODE = "@TYPE_CODE";
        private string UDF1 = "@UDF1";
        private string UDF10 = "@UDF10";
        private string UDF2 = "@UDF2";
        private string UDF3 = "@UDF3";
        private string UDF4 = "@UDF4";
        private string UDF5 = "@UDF5";
        private string UDF6 = "@UDF6";
        private string UDF7 = "@UDF7";
        private string UDF8 = "@UDF8";
        private string UDF9 = "@UDF9";
        private string UPDATED_BY = "@UPDATED_BY";
        private string WH_ID = "@WH_ID";

        public bool CheckTariffIDUnique(string tariffID, string whLoginID)
        {
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@TARIFF_ID", tariffID) };
            return (DBHelper.ExecuteScalar(CommandType.Text, this.SQL_CHECK_TARIFF_ID_UNIQUE.Replace("@_@", whLoginID), paras).ToString() == "1");
        }

        public bool CheckTariffIDUnique(DataBase dataBase, DbTransaction tran, string tariffID, string whLoginID)
        {
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@TARIFF_ID", tariffID) };
            return (dataBase.ExecuteScalar(tran, CommandType.Text, this.SQL_CHECK_TARIFF_ID_UNIQUE.Replace("@_@", whLoginID), paras).ToString() == "1");
        }

        public int DeleteTariff(List<string> tariffID, string whLoginID)
        {
            int result = 0;
            DataBase dataBase = new DataBase();
            DbConnection conn = dataBase.connection;
            conn.Open();
            DbTransaction tran = conn.BeginTransaction();
            try
            {
                for (int j = 0; j < tariffID.Count; j++)
                {
                    SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@TARIFF_ID", tariffID[j]) };
                    result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_DELETE_TARIFF.Replace("@_@", whLoginID), paras);
                }
                tran.Commit();
            }
            catch (SqlException sqlEx)
            {
                tran.Rollback();
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            finally
            {
                conn.Close();
            }
            return result;
        }

        public int DeleteTariff(DataBase dataBase, DbTransaction tran, List<string> tariffID, string whLoginID)
        {
            int result = 0;
            try
            {
                for (int j = 0; j < tariffID.Count; j++)
                {
                    SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@TARIFF_ID", tariffID[j]) };
                    result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_DELETE_TARIFF.Replace("@_@", whLoginID), paras);
                }
            }
            catch (SqlException sqlEx)
            {
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            return result;
        }

        public DataSet GetAllTariff(string whLoginID)
        {
            string sql = this.SQL_SELECT_ALL_TARIFF.Replace("@_@", whLoginID);
            return DBHelper.ExecuteDataSet(CommandType.Text, sql);
        }

        public DataSet GetAllTariff(DataBase dataBase, DbTransaction tran, string whLoginID)
        {
            string sql = this.SQL_SELECT_ALL_TARIFF.Replace("@_@", whLoginID);
            return dataBase.ExecuteDataSet(tran, CommandType.Text, sql);
        }

        public List<TariffInfo> GetTariffByByTypeCode(string tariffType, string typeCode, string whLoginID)
        {
            string sql = this.SQL_SELECT_ALL_TARIFF.Replace("@_@", whLoginID) + " WHERE TARIFF_TYPE = @TARIFF_TYPE AND TYPE_CODE = @TYPE_CODE ";
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@TARIFF_TYPE", tariffType), new SqlParameter("@TYPE_CODE", typeCode) };
            TariffInfo tariffInfo = null;
            List<TariffInfo> tariffInfos = new List<TariffInfo>();
            using (IDataReader reader = DBHelper.ExecuteReader(CommandType.Text, sql, paras))
            {
                while (reader.Read())
                {
                    DateTime CS00002;
                    tariffInfo = new TariffInfo((reader["ROWID"].ToString() != "") ? int.Parse(reader["ROWID"].ToString()) : 0, reader["WH_ID"].ToString(), reader["TARIFF_ID"].ToString(), reader["DESCR"].ToString(), reader["TARIFF_TYPE"].ToString(), reader["TYPE_CODE"].ToString(), reader["UDF1"].ToString(), reader["UDF2"].ToString(), reader["UDF3"].ToString(), reader["UDF4"].ToString(), reader["UDF5"].ToString(), reader["UDF6"].ToString(), reader["UDF7"].ToString(), reader["UDF8"].ToString(), reader["UDF9"].ToString(), reader["UDF10"].ToString(), (byte[]) reader["TS"], reader["IS_ACTIVE"].ToString(), reader["CREATED_BY"].ToString(), (reader["CREATED_DATE"].ToString() != "") ? DateTime.Parse(reader["CREATED_DATE"].ToString()) : (CS00002 = new DateTime()), reader["UPDATED_BY"].ToString(), (reader["UPDATED_DATE"].ToString() != "") ? DateTime.Parse(reader["UPDATED_DATE"].ToString()) : (CS00002 = new DateTime()));
                    tariffInfos.Add(tariffInfo);
                }
            }
            return tariffInfos;
        }

        public List<TariffInfo> GetTariffByByTypeCode(DataBase dataBase, DbTransaction tran, string tariffType, string typeCode, string whLoginID)
        {
            string sql = this.SQL_SELECT_ALL_TARIFF.Replace("@_@", whLoginID) + " WHERE TARIFF_TYPE = @TARIFF_TYPE AND TYPE_CODE = @TYPE_CODE ";
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@TARIFF_TYPE", tariffType), new SqlParameter("@TYPE_CODE", typeCode) };
            TariffInfo tariffInfo = null;
            List<TariffInfo> tariffInfos = new List<TariffInfo>();
            IDataReader reader = dataBase.ExecuteReader(tran, CommandType.Text, sql, paras);
            while (reader.Read())
            {
                DateTime CS00002;
                tariffInfo = new TariffInfo((reader["ROWID"].ToString() != "") ? int.Parse(reader["ROWID"].ToString()) : 0, reader["WH_ID"].ToString(), reader["TARIFF_ID"].ToString(), reader["DESCR"].ToString(), reader["TARIFF_TYPE"].ToString(), reader["TYPE_CODE"].ToString(), reader["UDF1"].ToString(), reader["UDF2"].ToString(), reader["UDF3"].ToString(), reader["UDF4"].ToString(), reader["UDF5"].ToString(), reader["UDF6"].ToString(), reader["UDF7"].ToString(), reader["UDF8"].ToString(), reader["UDF9"].ToString(), reader["UDF10"].ToString(), (byte[]) reader["TS"], reader["IS_ACTIVE"].ToString(), reader["CREATED_BY"].ToString(), (reader["CREATED_DATE"].ToString() != "") ? DateTime.Parse(reader["CREATED_DATE"].ToString()) : (CS00002 = new DateTime()), reader["UPDATED_BY"].ToString(), (reader["UPDATED_DATE"].ToString() != "") ? DateTime.Parse(reader["UPDATED_DATE"].ToString()) : (CS00002 = new DateTime()));
                tariffInfos.Add(tariffInfo);
            }
            if (!reader.IsClosed)
            {
                reader.Close();
            }
            return tariffInfos;
        }

        public TariffInfo GetTariffByID(string tariffID, string whLoginID)
        {
            string sql = this.SQL_SELECT_ALL_TARIFF.Replace("@_@", whLoginID) + " WHERE TARIFF_ID = @TARIFF_ID  ";
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@TARIFF_ID", tariffID) };
            TariffInfo tariffInfo = null;
            using (IDataReader reader = DBHelper.ExecuteReader(CommandType.Text, sql, paras))
            {
                if (reader.Read())
                {
                    tariffInfo = new TariffInfo((reader["ROWID"].ToString() != "") ? int.Parse(reader["ROWID"].ToString()) : 0, reader["WH_ID"].ToString(), reader["TARIFF_ID"].ToString(), reader["DESCR"].ToString(), reader["TARIFF_TYPE"].ToString(), reader["TYPE_CODE"].ToString(), reader["UDF1"].ToString(), reader["UDF2"].ToString(), reader["UDF3"].ToString(), reader["UDF4"].ToString(), reader["UDF5"].ToString(), reader["UDF6"].ToString(), reader["UDF7"].ToString(), reader["UDF8"].ToString(), reader["UDF9"].ToString(), reader["UDF10"].ToString(), (byte[]) reader["TS"], reader["IS_ACTIVE"].ToString(), reader["CREATED_BY"].ToString(), (reader["CREATED_DATE"].ToString() != "") ? DateTime.Parse(reader["CREATED_DATE"].ToString()) : new DateTime(), reader["UPDATED_BY"].ToString(), (reader["UPDATED_DATE"].ToString() != "") ? DateTime.Parse(reader["UPDATED_DATE"].ToString()) : new DateTime());
                }
            }
            return tariffInfo;
        }

        public TariffInfo GetTariffByID(DataBase dataBase, DbTransaction tran, string tariffID, string whLoginID)
        {
            string sql = this.SQL_SELECT_ALL_TARIFF.Replace("@_@", whLoginID) + " WHERE TARIFF_ID = @TARIFF_ID  ";
            SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@TARIFF_ID", tariffID) };
            TariffInfo tariffInfo = null;
            IDataReader reader = dataBase.ExecuteReader(tran, CommandType.Text, sql, paras);
            if (reader.Read())
            {
                tariffInfo = new TariffInfo((reader["ROWID"].ToString() != "") ? int.Parse(reader["ROWID"].ToString()) : 0, reader["WH_ID"].ToString(), reader["TARIFF_ID"].ToString(), reader["DESCR"].ToString(), reader["TARIFF_TYPE"].ToString(), reader["TYPE_CODE"].ToString(), reader["UDF1"].ToString(), reader["UDF2"].ToString(), reader["UDF3"].ToString(), reader["UDF4"].ToString(), reader["UDF5"].ToString(), reader["UDF6"].ToString(), reader["UDF7"].ToString(), reader["UDF8"].ToString(), reader["UDF9"].ToString(), reader["UDF10"].ToString(), (byte[]) reader["TS"], reader["IS_ACTIVE"].ToString(), reader["CREATED_BY"].ToString(), (reader["CREATED_DATE"].ToString() != "") ? DateTime.Parse(reader["CREATED_DATE"].ToString()) : new DateTime(), reader["UPDATED_BY"].ToString(), (reader["UPDATED_DATE"].ToString() != "") ? DateTime.Parse(reader["UPDATED_DATE"].ToString()) : new DateTime());
            }
            if (!reader.IsClosed)
            {
                reader.Close();
            }
            return tariffInfo;
        }

        public DataSet GetTariffByQueryList(List<string> sqlWhere, TariffQueryEntity tariffQuery, string whLoginID, PubParasInfo pubParasInfo)
        {
            string temp = this.SQL_SELECT_ALL_TARIFF_LANGUAGE.Replace("@_@", whLoginID);
            for (int i = 0; i < sqlWhere.Count; i++)
            {
                if (i == 0)
                {
                    temp = temp + " WHERE " + sqlWhere[i].ToString();
                }
                else
                {
                    temp = temp + " AND " + sqlWhere[i].ToString();
                }
            }
            if (!tariffQuery.IsGetAll)
            {
                temp = PagingHelper.GetPagingSQL(temp, tariffQuery.CurrentPage, tariffQuery.PageSize, tariffQuery.SortField, tariffQuery.SortDirection).Replace("@LANGUAGE", "''" + pubParasInfo.UserLanguage + "''");
            }
            else
            {
                temp = temp.Replace("@LANGUAGE", "'" + pubParasInfo.UserLanguage + "'");
            }
            return DBHelper.ExecuteDataSet(CommandType.Text, temp);
        }

        public DataSet GetTariffByQueryList(DataBase dataBase, DbTransaction tran, List<string> sqlWhere, TariffQueryEntity tariffQuery, string whLoginID)
        {
            string temp = this.SQL_SELECT_ALL_TARIFF.Replace("@_@", whLoginID);
            for (int i = 0; i < sqlWhere.Count; i++)
            {
                if (i == 0)
                {
                    temp = temp + " WHERE " + sqlWhere[i].ToString();
                }
                else
                {
                    temp = temp + " AND " + sqlWhere[i].ToString();
                }
            }
            temp = PagingHelper.GetPagingSQL(temp, tariffQuery.CurrentPage, tariffQuery.PageSize, tariffQuery.SortField, tariffQuery.SortDirection);
            return dataBase.ExecuteDataSet(tran, CommandType.Text, temp);
        }

        public int InsertTariff(TariffInfo tariffInfo, string whLoginID)
        {
            int result = 0;
            DataBase db = new DataBase();
            DbConnection conn = db.connection;
            conn.Open();
            DbTransaction tran = conn.BeginTransaction();
            try
            {
                tariffInfo.WhID = whLoginID.Substring(0, whLoginID.Length - 1);
                SqlParameter[] paras = this.Set_Tariff_Parameters(tariffInfo);
                if (paras != null)
                {
                    result += db.ExecuteNonQuery(tran, CommandType.Text, this.SQL_INSERT_TARIFF.Replace("@_@", whLoginID), paras);
                }
                tran.Commit();
            }
            catch (SqlException sqlEx)
            {
                tran.Rollback();
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            finally
            {
                conn.Close();
            }
            return result;
        }

        public int InsertTariff(DataBase dataBase, DbTransaction tran, TariffInfo tariffInfo, string whLoginID)
        {
            int result = 0;
            try
            {
                tariffInfo.WhID = whLoginID.Substring(0, whLoginID.Length - 1);
                SqlParameter[] paras = this.Set_Tariff_Parameters(tariffInfo);
                if (paras != null)
                {
                    result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_INSERT_TARIFF.Replace("@_@", whLoginID), paras);
                }
            }
            catch (SqlException sqlEx)
            {
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            return result;
        }

        private SqlParameter[] Set_Tariff_Parameters(TariffInfo tariffInfo)
        {
            SqlParameter[] paramArray = new SqlParameter[] { 
                new SqlParameter(this.WH_ID, SqlDbType.VarChar, 30), new SqlParameter(this.TARIFF_ID, SqlDbType.VarChar, 20), new SqlParameter(this.DESCR, SqlDbType.VarChar, 100), new SqlParameter(this.TARIFF_TYPE, SqlDbType.VarChar, 20), new SqlParameter(this.TYPE_CODE, SqlDbType.VarChar, 20), new SqlParameter(this.UDF1, SqlDbType.VarChar, 30), new SqlParameter(this.UDF2, SqlDbType.VarChar, 30), new SqlParameter(this.UDF3, SqlDbType.VarChar, 30), new SqlParameter(this.UDF4, SqlDbType.VarChar, 30), new SqlParameter(this.UDF5, SqlDbType.VarChar, 30), new SqlParameter(this.UDF6, SqlDbType.VarChar, 30), new SqlParameter(this.UDF7, SqlDbType.VarChar, 30), new SqlParameter(this.UDF8, SqlDbType.VarChar, 30), new SqlParameter(this.UDF9, SqlDbType.VarChar, 30), new SqlParameter(this.UDF10, SqlDbType.VarChar, 30), new SqlParameter(this.IS_ACTIVE, SqlDbType.VarChar, 1), 
                new SqlParameter(this.CREATED_BY, SqlDbType.VarChar, 20), new SqlParameter(this.UPDATED_BY, SqlDbType.VarChar, 20)
             };
            if (!string.IsNullOrEmpty(tariffInfo.WhID))
            {
                paramArray[0].Value = tariffInfo.WhID;
            }
            else
            {
                paramArray[0].Value = DBNull.Value;
            }
            paramArray[1].Value = tariffInfo.TariffID;
            if (!string.IsNullOrEmpty(tariffInfo.Descr))
            {
                paramArray[2].Value = tariffInfo.Descr;
            }
            else
            {
                paramArray[2].Value = DBNull.Value;
            }
            paramArray[3].Value = tariffInfo.TariffType;
            if (!string.IsNullOrEmpty(tariffInfo.TypeCode))
            {
                paramArray[4].Value = tariffInfo.TypeCode;
            }
            else
            {
                paramArray[4].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(tariffInfo.Udf1))
            {
                paramArray[5].Value = tariffInfo.Udf1;
            }
            else
            {
                paramArray[5].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(tariffInfo.Udf2))
            {
                paramArray[6].Value = tariffInfo.Udf2;
            }
            else
            {
                paramArray[6].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(tariffInfo.Udf3))
            {
                paramArray[7].Value = tariffInfo.Udf3;
            }
            else
            {
                paramArray[7].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(tariffInfo.Udf4))
            {
                paramArray[8].Value = tariffInfo.Udf4;
            }
            else
            {
                paramArray[8].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(tariffInfo.Udf5))
            {
                paramArray[9].Value = tariffInfo.Udf5;
            }
            else
            {
                paramArray[9].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(tariffInfo.Udf6))
            {
                paramArray[10].Value = tariffInfo.Udf6;
            }
            else
            {
                paramArray[10].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(tariffInfo.Udf7))
            {
                paramArray[11].Value = tariffInfo.Udf7;
            }
            else
            {
                paramArray[11].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(tariffInfo.Udf8))
            {
                paramArray[12].Value = tariffInfo.Udf8;
            }
            else
            {
                paramArray[12].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(tariffInfo.Udf9))
            {
                paramArray[13].Value = tariffInfo.Udf9;
            }
            else
            {
                paramArray[13].Value = DBNull.Value;
            }
            if (!string.IsNullOrEmpty(tariffInfo.Udf10))
            {
                paramArray[14].Value = tariffInfo.Udf10;
            }
            else
            {
                paramArray[14].Value = DBNull.Value;
            }
            paramArray[15].Value = tariffInfo.IsActive;
            paramArray[0x10].Value = tariffInfo.CreatedBy;
            paramArray[0x11].Value = tariffInfo.UpdatedBy;
            return paramArray;
        }

        public int UpdateTariff(TariffInfo tariffInfo, string whLoginID)
        {
            int result = 0;
            DataBase db = new DataBase();
            DbConnection conn = db.connection;
            conn.Open();
            DbTransaction tran = conn.BeginTransaction();
            try
            {
                tariffInfo.WhID = whLoginID.Substring(0, whLoginID.Length - 1);
                SqlParameter[] paras = this.Set_Tariff_Parameters(tariffInfo);
                if (paras != null)
                {
                    result += db.ExecuteNonQuery(tran, CommandType.Text, this.SQL_UPDATE_TARIFF.Replace("@_@", whLoginID), paras);
                }
                tran.Commit();
            }
            catch (SqlException sqlEx)
            {
                tran.Rollback();
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            finally
            {
                conn.Close();
            }
            return result;
        }

        public int UpdateTariff(DataBase dataBase, DbTransaction tran, TariffInfo tariffInfo, string whLoginID)
        {
            int result = 0;
            try
            {
                tariffInfo.WhID = whLoginID.Substring(0, whLoginID.Length - 1);
                SqlParameter[] paras = this.Set_Tariff_Parameters(tariffInfo);
                if (paras != null)
                {
                    result += dataBase.ExecuteNonQuery(tran, CommandType.Text, this.SQL_UPDATE_TARIFF.Replace("@_@", whLoginID), paras);
                }
            }
            catch (SqlException sqlEx)
            {
                CommonErrorHandler.ErrorHandler(sqlEx, LogType.Error);
            }
            return result;
        }
    }
}

